package com.pj.wisdomlogistics.ui.activity;

import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.pj.wisdomlogistics.R;
import com.pj.wisdomlogistics.entity.WeekSsMenuInfo;
import com.pj.wisdomlogistics.other.EventCenter;
import com.pj.wisdomlogistics.ui.adapter.PopWeekMenuAdapter;
import com.pj.wisdomlogistics.utils.ActivityManagerUtil;

import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

public class WeekMenuActivity extends BaseActivity{
    @BindView(R.id.tv_menu_title)
    TextView mTvMenuTitle;
    @BindView(R.id.rv_week_menu)
    RecyclerView mRvWeekMenu;
    @BindView(R.id.ll_layout)
    LinearLayout mLayout;

    private PopWeekMenuAdapter mAdapter;
    private List<WeekSsMenuInfo> mList;

    @Override
    public void initView() {

        Intent intent = this.getIntent();
        mList = (List<WeekSsMenuInfo>)intent.getSerializableExtra("week_menu");

        if(intent.getIntExtra("type" , -1) == 1){
            mTvMenuTitle.setText("一周熟食外卖菜单");
        }else{
            mTvMenuTitle.setText("一周面食外卖菜单");
        }

        mRvWeekMenu.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        mAdapter = new PopWeekMenuAdapter(this);
        mRvWeekMenu.setAdapter(mAdapter);
        mAdapter.setList(mList);

        mRvWeekMenu.setLayoutFrozen(false);
    }



    @Override
    public void initData() {

    }

    @Override
    public int getContentView() {
        return R.layout.activity_week_menu;
    }

    @Override
    public boolean isApplyEventBus() {
        return false;
    }

    @Override
    public boolean isApplyButterKnife() {
        return true;
    }

    @Override
    public void onEventCome(EventCenter eventCenter) {

    }

    @OnClick(R.id.iv_back)
    public void onClick(){
        ActivityManagerUtil.create().finishActivity();
    }

}
